﻿Imports System.ComponentModel
Imports FountainHead.ViewModel.Controls
Imports FountainHead.ViewModel.Interfaces

Namespace Properties

    <DefaultPropertyAttribute("Text"), _
DescriptionAttribute("Control Properties")> _
    Public MustInherit Class BaseProperties
        Implements INotifyPropertyChanged
        Implements IProperties

        Public Sub New()

        End Sub
        Public Sub New(ByVal vm As BaseControlViewModel)
            baseViewModelValue = vm
        End Sub
#Region "Properties"
        Private baseViewModelValue As BaseControlViewModel
        Public Overridable Property ViewModel() As BaseControlViewModel
            Get
                Return baseViewModelValue
            End Get
            Set(ByVal value As BaseControlViewModel)
                baseViewModelValue = value
            End Set
        End Property
        <CategoryAttribute("Control"), _
           Browsable(True), _
           [ReadOnly](False), _
           BindableAttribute(False), _
           DefaultValueAttribute(""), _
           DesignOnly(False), _
           DescriptionAttribute("Enter Left position")> _
        Public Property Left() As Integer Implements IProperties.Left
            Get

                Return ViewModel.Left
            End Get
            Set(ByVal value As Integer)
                If ViewModel.Left = value Then Return
                ViewModel.Left = value
                RaiseEvent PropertyChanged(Me, New System.ComponentModel.PropertyChangedEventArgs("Left"))
            End Set
        End Property

        <CategoryAttribute("Control"), _
           Browsable(True), _
           [ReadOnly](False), _
           BindableAttribute(False), _
           DefaultValueAttribute(""), _
           DesignOnly(False), _
           DescriptionAttribute("Enter Top position")> _
        Public Property Top() As Integer Implements IProperties.Top
            Get
                Return ViewModel.Top
            End Get
            Set(ByVal value As Integer)
                If ViewModel.Top = value Then Return
                ViewModel.Top = value
                RaiseEvent PropertyChanged(Me, New System.ComponentModel.PropertyChangedEventArgs("Top"))
            End Set
        End Property

        <CategoryAttribute("Control"), _
        Browsable(True), _
        [ReadOnly](False), _
        BindableAttribute(False), _
        DefaultValueAttribute(""), _
        DesignOnly(False), _
        DescriptionAttribute("Name for Control")> _
        Public Property Name() As String
            Get
                Return ViewModel.Name
            End Get
            Set(ByVal value As String)
                ViewModel.Name = value

            End Set
        End Property
#End Region

#Region "Events Handlers"
        Public Sub OnPropertyChanged(ByVal e As PropertyChangedEventArgs)
            RaiseEvent PropertyChanged(Me, New System.ComponentModel.PropertyChangedEventArgs(e.PropertyName))
        End Sub

#End Region
        Public Event PropertyChanged(ByVal sender As Object, ByVal e As PropertyChangedEventArgs) Implements INotifyPropertyChanged.PropertyChanged
    End Class


End Namespace